﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace exerciseSix
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入两个数：");
            int number1 = int.Parse(Console.ReadLine());
            int number2 = int.Parse(Console.ReadLine());
           Console.WriteLine("最大公约数为："+ Biggest(number1, number2)) ;
            Console.ReadKey();
        }
        ///<summary>
        ///计算公约数
        ///</summary>summary>
        ///<param name="a">第一个数</param>
        ///<param name="b">第二个数</param>
        ///<returns>计算结果</param>
        static int Biggest(int a,int b)
        {
            if (a%b==0)
            {
                return b;
            }
            return Biggest(b, a % b);
        }
    }
}
